package com.tange.ai.iot.client.gnssa.utils

import android.content.Context
import androidx.preference.PreferenceManager

object SP {

    fun saveString(context: Context, key: String, value: String) {
        val sharedPrefs = PreferenceManager.getDefaultSharedPreferences(context);
        sharedPrefs.edit().putString(key, value).apply()
    }

    fun getString(context: Context, key: String): String {
        val sharedPrefs = PreferenceManager.getDefaultSharedPreferences(context);
        return sharedPrefs.getString(key, "") ?: ""
    }


    fun getString(context: Context, key: String, default: String): String {
        val sharedPrefs = PreferenceManager.getDefaultSharedPreferences(context);
        return sharedPrefs.getString(key, default) ?: default
    }

    fun getBoolean(context: Context, key: String, default: Boolean): Boolean {
        val sharedPrefs = PreferenceManager.getDefaultSharedPreferences(context);
        return sharedPrefs.getBoolean(key, default)
    }
}




























